package ru.amse.tsyganov.jumleditor.view;

import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Rectangle;

public abstract class ResizeActivePoint extends ActivePoint {
	
	public abstract int getNewWidth();
	
	public abstract int getNewHeight();
	
	public abstract Rectangle getTemporaryRectangle();

	@Override
	public final void paintTempResult(GC gc) {
		assert gc != null;
		
		gc.setAlpha(50);
		
		gc.setBackground(Colors.getBlackColor());
		gc.setForeground(Colors.getBlackColor());
		
		gc.fillRectangle(getTemporaryRectangle());
		gc.drawRectangle(getTemporaryRectangle());
		
		gc.setAlpha(255);
	}

	protected final boolean isNewResultsCorrect() {
		return !(getNewWidth() < 20 || getNewHeight() < 20);
	}

}
